# -*- coding: utf-8 -*-
"""
:mod:`nubio.core.atom`
======================

The ``nubio.core.atom`` module provides support for 3D structures: atoms, 
molecules and macromolecules. It includes array containers for coordinate data
and PDB fields.

"""

from nubox.core import NuBoxScalar, NuBoxVector
from nubox.double import Double, DoubleVector

ATOM_DUMMY = (0., 0., 0.)
ATOMDATA_DUMMY = ('      ', 0, '    ', ' ', '   ', ' ', 0, ' ', 0., 0., '  ', '  ')

class Atom(Double):
    """
    Represents a point in 3d Cartesian coordinates.
    
    """
    clsdummy = ATOM_DUMMY


class Model(Atom, DoubleVector):
    """
    Represents a vector of ``Atom`` instances.
    """
    clschild = Atom

class AtomData(NuBoxScalar):
    """
    A ``NuBoxScalar`` with a structured data type to store the non-coordinate 
    fields in a "ATOM" or "HETATM" PDB-line. See: ``nubio.io.pdb`` for details.
    fields: 

      - ('at_type','S6'),
      - ('ser_num','int32'),
      - ('at_id','S4'),
      - ('alt_loc','S1'),
      - ('res_name','S3'),
      - ('chain_id','S1'),
      - ('res_id','int32'),
      - ('res_ic','S1'),
      - ('occupancy','float64'),
      - ('bfactor','float64'),
      - ('element','S2'),
      - ('charge','S2')

    """
    clsstore = 'list'
    clstypecode = 'o'
    clsdummy = ATOMDATA_DUMMY
    clsshape = (len(ATOMDATA_DUMMY),)


class ModelData(AtomData, NuBoxVector):
    """
    Represents a vector of ``AtomData``. See: ``AtomData``.
    
    """
    clschild = AtomData
    clsshape = None

